<?php

namespace app\index\controller;
use app\admin\service\OssService;
use app\index\model\BannerModel;
use app\index\model\HorkeyModel;
use app\BaseController;

class Home extends BaseController
{
    public function swiperList() {
        $sql = new BannerModel();
        $list = $sql->order('sort desc')->select();
        if(config('app.imgtype') == 'other') {
            foreach ($list as $k => $item) {
                $item['image'] = $item['image'];
            }
            return result()->success($list);
        } else {
            $oss = new OssService();
            return result()->success($oss->signIds($list, 'image_id', 'image'));
        }

    }

    public function horKeyList() {
        $sql = new HorkeyModel();
        $list = $sql->order('sort desc')->select();
        return result()->success($list);
    }
}
